<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles"
	prefix="tiles"%>
<script>
	function setValue(t){
		document.getElementById("pform:test").value = t;
	}
</script>
<h:inputHidden validator="#{memberCompProspectProductAsGift.validator}" value="#{memberCompProspectProductAsGift.flag}" id="test"></h:inputHidden>
<rich:panel header="#{messages['company.member.registration']}">
	<h:panelGrid>
		<h:outputText value="#{errorBean.errorMessage}" styleClass="error"></h:outputText>
	</h:panelGrid>

	<h:panelGrid width="100%">
		<h:outputText value="#{messages['membership.info']}" styleClass="sub_header" />
		<h:panelGroup>
			<h:outputText value="*" styleClass="standardText_Mandatory" />
			<h:outputText value="#{messages['instruction']}" styleClass="standardText_Instruction" />
		</h:panelGroup>
	</h:panelGrid>

	<t:panelGrid columns="2" columnClasses="standardTable_ColumnLeft_20,standardTable_ColumnLeft_80" width="100%">

		<h:outputText></h:outputText>
		<t:message for="name" styleClass="error"></t:message>

		<h:panelGroup>
			<h:outputText value="*" styleClass="standardText_Mandatory" />
			<h:outputLabel for="name" value="#{messages['name']}" styleClass="standardText_Label" />
		</h:panelGroup>
		<h:panelGroup>
			<t:inputText id="name" required="true" size="50" maxlength="50" styleClass="standardText" value="#{memberCompProspectProductAsGift.member.name}"></t:inputText>
		</h:panelGroup>
		
		<h:outputText></h:outputText>
		<t:message for="nameoncard" styleClass="error"></t:message>

		<h:panelGroup>
			<h:outputText value="*" styleClass="standardText_Mandatory" />
			<h:outputLabel for="nameoncard" value="#{messages['name.on.card']}" styleClass="standardText_Label" />
		</h:panelGroup>
		<h:panelGroup>
			<t:inputText id="nameoncard" required="true" size="50" maxlength="50" styleClass="standardText" value="#{memberCompProspectProductAsGift.member.nameOnCard}"></t:inputText>
		</h:panelGroup>
		
		<h:outputText></h:outputText>
		<t:message for="statement" styleClass="error"></t:message>
	
		<h:panelGroup>
			<h:outputText value="*" styleClass="standardText_Mandatory" />
			<h:outputLabel for="statement" value="#{messages['statement']}" styleClass="standardText_Label" />
		</h:panelGroup>
		<h:panelGroup>
			<t:selectOneRadio id="statement" styleClass="standardText" value="#{memberCompProspectProductAsGift.memberComp.statementType}" required="true">
				<f:selectItems value="#{memberCompProspectProductAsGift.statementTypeList}"/>
			</t:selectOneRadio>
		</h:panelGroup>
		
		<h:outputText></h:outputText>
		<t:message for="sendstatement" styleClass="error"></t:message>
	
		<h:panelGroup>
			<h:outputText value="*" styleClass="standardText_Mandatory" />
			<h:outputLabel for="sendstatement" value="#{messages['send.statement']}" styleClass="standardText_Label" />
		</h:panelGroup>
		<h:panelGroup>
			<t:selectOneRadio id="sendstatement" styleClass="standardText" value="#{memberCompProspectProductAsGift.memberComp.statement}" required="true">
				<f:selectItems value="#{memberCompProspectProductAsGift.yesNoSelectList}"/>
			</t:selectOneRadio>
		</h:panelGroup>
		
		<h:outputText></h:outputText>
		<t:message for="othertimeshare" styleClass="error"></t:message>
	
		<h:panelGroup>
			<h:outputText value="*" styleClass="standardText_Mandatory" />
			<h:outputLabel for="othertimeshare" value="#{messages['member.of.other.timeshare']}" styleClass="standardText_Label" />
		</h:panelGroup>
		<h:panelGroup>
			<t:selectOneRadio id="othertimeshare" styleClass="standardText" value="#{memberCompProspectProductAsGift.memberComp.timeshareCompFlag}" required="true">
				<f:selectItems value="#{memberCompProspectProductAsGift.yesNoSelectList}"/>
			</t:selectOneRadio>
		</h:panelGroup>
		
		<h:outputText></h:outputText>
		<t:message for="email" styleClass="error"></t:message>
		
	   <h:panelGroup>
		   	<h:outputText value="*" styleClass="standardText_Mandatory" />	
		    <h:outputLabel for="email" value="#{messages['email']}" styleClass="standardText_Label" />
	   </h:panelGroup>
	   <h:panelGroup>
	   	<t:inputText id="email" required="true" size="50" maxlength="50" styleClass="standardText" value="#{memberCompProspectProductAsGift.memberComp.email}">
	   		<t:validateEmail></t:validateEmail>
	   	</t:inputText>
	   </h:panelGroup>
	   
	   <%--<h:outputText></h:outputText>
		<t:message for="image" styleClass="error"></t:message>
		
		<h:panelGroup>
			<h:outputLabel for="image" value="#{messages['image']}" styleClass="standardText_Label" />
		</h:panelGroup>
		<h:panelGroup>
			<t:inputFileUpload id="image" storage="file" size="50"  required="false"></t:inputFileUpload>
		</h:panelGroup>--%>

	</t:panelGrid>
	
	<h:panelGrid width="100%">
		<h:outputText value="#{messages['company.info']}"
			styleClass="sub_header" />
	</h:panelGrid>
	
	<t:panelGrid id="compInfo" columns="2" columnClasses="standardTable_ColumnLeft_20,standardTable_ColumnLeft_80" width="100%">
		<h:outputText></h:outputText>
		<t:message for="CompanyName" styleClass="error"></t:message>
		
		<h:panelGroup>
			 <h:outputText value="*" styleClass="standardText_Mandatory"/>
			<h:outputLabel for="CompanyName" value="#{messages['name']}" styleClass="standardText_Label" />
		</h:panelGroup>
		<t:inputText id="CompanyName" size="50" maxlength="50" required="true" styleClass="standardText" value="#{memberCompProspectProductAsGift.memberComp.compName}"></t:inputText>
		
		
		
		<h:outputText></h:outputText>
		<t:message for="establish" styleClass="error"></t:message>
	
	    <h:panelGroup>
		    <h:outputLabel for="establish" value="#{messages['establish.date']}" styleClass="standardText_Label" />
	    </h:panelGroup>
	    <h:panelGroup>
	    	<t:inputCalendar
	    	id="establish"
				monthYearRowClass="yearMonthHeader" weekRowClass="weekHeader" 
				currentDayCellClass="currentDayCell" value="#{memberCompProspectProductAsGift.memberComp.dateIncorporation}"
				renderAsPopup="true" popupTodayString="#{messages['popup.today']}"
				popupWeekString="#{messages['popup.week']}" popupDateFormat="dd/MM/yyyy"
				renderPopupButtonAsImage="true"
				styleClass="standardText" required="false">
	    	</t:inputCalendar>
	    </h:panelGroup>
	    
	    <h:outputText></h:outputText>
		<t:message for="RegNo" styleClass="error"></t:message>
		
		<h:panelGroup>
			 <h:outputText value="*" styleClass="standardText_Mandatory"/>
			<h:outputLabel for="RegNo" value="#{messages['registration.no']}" styleClass="standardText_Label" />
		</h:panelGroup>
		<t:inputText id="RegNo" size="50" maxlength="50" required="true" styleClass="standardText" value="#{memberCompProspectProductAsGift.memberComp.registerNo}"></t:inputText>
		
		<h:outputText></h:outputText>
		<t:message for="AccRefNo" styleClass="error"></t:message>
		
		<h:panelGroup>
			 <h:outputText value="*" styleClass="standardText_Mandatory"/>
			<h:outputLabel for="AccRefNo" value="#{messages['account.reference.no']}" styleClass="standardText_Label" />
		</h:panelGroup>
		<t:inputText id="AccRefNo" size="50" maxlength="50" styleClass="standardText" required="true" value="#{memberCompProspectProductAsGift.memberComp.accRefNo}"></t:inputText>
		
		<h:outputText></h:outputText>
		<t:message for="natureofbusiness" styleClass="error"></t:message>
		
		<h:panelGroup>
			 <%--<h:outputText value="*" styleClass="standardText_Mandatory"/>--%>
			<h:outputLabel for="natureofbusiness" value="#{messages['nature.of.business']}" styleClass="standardText_Label" />
		</h:panelGroup>
		<t:inputText id="natureofbusiness" size="50" maxlength="50" styleClass="standardText" value="#{memberCompProspectProductAsGift.memberComp.natureOfBuz}"></t:inputText>
		
		<h:outputText></h:outputText>
		<t:message for="contactperson" styleClass="error"></t:message>

		<h:panelGroup>
			<h:outputText value="*" styleClass="standardText_Mandatory" />
			<h:outputLabel for="contactperson" value="#{messages['contact.person']}" styleClass="standardText_Label" />
		</h:panelGroup>
		<h:panelGroup>
			<t:inputText id="contactperson" required="true" size="50" maxlength="50" styleClass="standardText" value="#{memberCompProspectProductAsGift.memberComp.contactPerson}"></t:inputText>
		</h:panelGroup>
		
		<h:outputText></h:outputText>
		<t:message for="designation" styleClass="error"></t:message>

		<h:panelGroup>
			<h:outputText value="*" styleClass="standardText_Mandatory" />
			<h:outputLabel for="designation" value="#{messages['designation']}" styleClass="standardText_Label" />
		</h:panelGroup>
		<h:panelGroup>
			<t:inputText id="designation" required="true" size="50" maxlength="50" styleClass="standardText" value="#{memberCompProspectProductAsGift.memberComp.designation}"></t:inputText>
		</h:panelGroup>
   
		<h:outputText></h:outputText>
		<t:message for="CompanyAdress1" styleClass="error"></t:message>
		
		<h:panelGroup>
			 <h:outputText value="*" styleClass="standardText_Mandatory"/>
	    	<h:outputLabel for="CompanyAdress1" value="#{messages['address']}" styleClass="standardText_Label" />
		</h:panelGroup>
		<t:inputText id="CompanyAdress1" size="50" maxlength="50"  required="true" styleClass="standardText" value="#{memberCompProspectProductAsGift.memberComp.regAddress1}"></t:inputText>
	    
	    <h:outputText></h:outputText>
		<t:message for="CompanyAdress2" styleClass="error"></t:message>
	    
	    <h:panelGroup></h:panelGroup>
	    <h:panelGroup>
	    	<t:inputText id="CompanyAdress2" size="50" maxlength="50" styleClass="standardText" value="#{memberCompProspectProductAsGift.memberComp.regAddress2}"></t:inputText>
	    </h:panelGroup>
	    
	    <h:outputText></h:outputText>
		<t:message for="CompanyPostcode" styleClass="error"></t:message>
	    
	    <h:panelGroup>
			 <h:outputText value="*" styleClass="standardText_Mandatory" />
	    	<h:outputLabel for="CompanyPostcode" value="#{messages['postcode']}" styleClass="standardText_Label" />
	    </h:panelGroup>
    	<t:inputText id="CompanyPostcode" size="50" maxlength="5" required="true" styleClass="standardText" 
    	value="#{memberCompProspectProductAsGift.memberComp.regPostcode}">
    		<t:validateRegExpr pattern="\d{5}|\d{4}"/>
    	</t:inputText>
    	
    	<h:outputText></h:outputText>
		<t:message for="CompanyCity" styleClass="error"></t:message>
	    
	    <h:panelGroup>
			 <h:outputText value="*" styleClass="standardText_Mandatory"/>		
	    	<h:outputLabel for="CompanyCity" value="#{messages['city']}" styleClass="standardText_Label" />
	    </h:panelGroup>
        <t:inputText id="CompanyCity" size="50" maxlength="50" required="true" styleClass="standardText" value="#{memberCompProspectProductAsGift.memberComp.regCity}"></t:inputText>
	    	
	    <h:outputText></h:outputText>
		<t:message for="CompanyCountry" styleClass="error"></t:message>
	    
	    <h:panelGroup>
			 <h:outputText value="*" styleClass="standardText_Mandatory"/>
	    <h:outputLabel for="CompanyCountry" value="#{messages['country']}" styleClass="standardText_Label" />
	    </h:panelGroup>
    	<t:selectOneMenu id="CompanyCountry" required="true"  styleClass="standardText" value="#{memberCompProspectProductAsGift.indCompcountryId}">
    		<f:selectItem  itemLabel="#{messages['please.select']}" itemValue=""/>
    		<f:selectItems value="#{memberCompProspectProductAsGift.countrySelectList}" />
			<a4j:support event="onclick" reRender="CompanyState" ajaxSingle="true" />
    	</t:selectOneMenu>
    	
    	<h:outputText></h:outputText>
		<t:message for="CompanyState" styleClass="error"></t:message>
	    
	    <h:panelGroup>
			 <h:outputText value="*" styleClass="standardText_Mandatory" />
	   		<h:outputLabel for="CompanyState" value="#{messages['state']}" styleClass="standardText_Label" />
	    </h:panelGroup>
    	<t:selectOneMenu id="CompanyState" required="true" styleClass="standardText" value="#{memberCompProspectProductAsGift.indCompStateId}">
    		<f:selectItem  itemLabel="#{messages['please.select']}" itemValue=""/>
    		<f:selectItems value="#{memberCompProspectProductAsGift.indCompStateSelectList}" />
    	</t:selectOneMenu>
    	
	    
	    <h:outputText></h:outputText>
		<t:message for="TelephoneNoOffice" styleClass="error"></t:message>
	    
	    <h:outputLabel for="TelephoneNoOffice" value="#{messages['telephone.no']}" styleClass="standardText_Label" />
    	<t:inputText id="TelephoneNoOffice" required="false" size="50" maxlength="50" styleClass="standardText" value="#{memberCompProspectProductAsGift.memberComp.compTel}">
    		<t:validateRegExpr pattern="\d{2}-\d{8}"/>
    	</t:inputText>
	    
	    <h:outputText></h:outputText>
		<t:message for="FaxNoOffice" styleClass="error"></t:message>	
	    
	    <h:outputLabel for="FaxNoOffice" value="#{messages['fax.no']}" styleClass="standardText_Label" />
    	<t:inputText id="FaxNoOffice" required="false" size="50" maxlength="50" styleClass="standardText" value="#{memberCompProspectProductAsGift.memberComp.compFax}">
    		<t:validateRegExpr pattern="\d{2}-\d{8}"/>
    	</t:inputText>
	</t:panelGrid>
	
	<h:panelGrid width="100%">
		<h:outputText value="#{messages['mailing.info']}"
			styleClass="sub_header" />
	</h:panelGrid>
	
	<t:panelGrid id="mailInfo" columns="2" columnClasses="standardTable_ColumnLeft_20,standardTable_ColumnLeft_80" width="100%">
	
		<h:outputText></h:outputText>
		<t:message for="MailBy" styleClass="error"></t:message>
		
		<h:panelGroup>
			<h:outputText value="*" styleClass="standardText_Mandatory" />
			<h:outputLabel for="MailBy" value="#{messages['mail.by']}"
				styleClass="standardText_Label" />
		</h:panelGroup>
		<h:panelGroup>
			<t:selectOneRadio id="MailBy" styleClass="standardText" value="#{memberCompProspectProductAsGift.compMailSelect}">
				<f:selectItems value="#{memberCompProspectProductAsGift.compMailSelectList}" />
				<a4j:support event="onclick" reRender="mailInfo" ajaxSingle="true"/>
			</t:selectOneRadio>
		</h:panelGroup>
		
		
		<h:outputText></h:outputText>
		<t:message for="MailAddress1" styleClass="error"></t:message>
		
		<h:panelGroup>
			<h:outputText value="*" styleClass="standardText_Mandatory" rendered="#{!memberCompProspectProductAsGift.mailFlag}"/>
			<h:outputLabel for="MailAddress1" value="#{messages['mail.address']}" styleClass="standardText_Label" />
		</h:panelGroup>
		
	    <t:inputText id="MailAddress1" size="50" readonly="#{memberCompProspectProductAsGift.mailFlag}" maxlength="50" required="#{!memberCompProspectProductAsGift.mailFlag}" styleClass="standardText" value="#{memberCompProspectProductAsGift.memberComp.mailAddress1}"></t:inputText>
	     
	    <h:outputText></h:outputText>
		<t:message for="MailAddress2" styleClass="error"></t:message>
	     
	    <h:panelGroup></h:panelGroup>
	    <h:panelGroup>
	    	<t:inputText id="MailAddress2" readonly="#{memberCompProspectProductAsGift.mailFlag}" size="50" maxlength="50" styleClass="standardText" value="#{memberCompProspectProductAsGift.memberComp.mailAddress2}"></t:inputText>
	    </h:panelGroup>
	    
	    <h:outputText></h:outputText>
		<t:message for="MailPostcode" styleClass="error"></t:message>
	    
	    <h:panelGroup>
			<h:outputText value="*" styleClass="standardText_Mandatory" rendered="#{!memberCompProspectProductAsGift.mailFlag}"/>
			<h:outputLabel for="MailPostcode" value="#{messages['mail.postcode']}" styleClass="standardText_Label" />
		</h:panelGroup>
	    <t:inputText id="MailPostcode" readonly="#{memberCompProspectProductAsGift.mailFlag}" size="50" maxlength="5" required="#{!memberCompProspectProductAsGift.mailFlag}" styleClass="standardText" value="#{memberCompProspectProductAsGift.memberComp.mailPostcode}">
	    		<t:validateRegExpr pattern="\d{5}|\d{4}"/>
	    </t:inputText>
	    
	     <h:outputText></h:outputText>
		<t:message for="MailCity" styleClass="error"></t:message>
	    
	    <h:panelGroup>
			 <h:outputText value="*" styleClass="standardText_Mandatory" rendered="#{!memberCompProspectProductAsGift.mailFlag}"/>
			 <h:outputLabel for="MailCity" value="#{messages['mail.city']}" styleClass="standardText_Label" />
		</h:panelGroup>	
		<t:inputText readonly="#{memberCompProspectProductAsGift.mailFlag}" id="MailCity" required="#{!memberCompProspectProductAsGift.mailFlag}" size="50" maxlength="50" styleClass="standardText" value="#{memberCompProspectProductAsGift.memberComp.mailCity}"></t:inputText>
	
	    	
	    <h:outputText></h:outputText>
		<t:message for="MailCountry" styleClass="error"></t:message>
	    
	     <h:panelGroup>
			 <h:outputText value="*" styleClass="standardText_Mandatory" rendered="#{!memberCompProspectProductAsGift.mailFlag}"/>
			 <h:outputLabel for="MailCountry" value="#{messages['mail.country']}" styleClass="standardText_Label" />
		</h:panelGroup>
    	<t:selectOneMenu readonly="#{memberCompProspectProductAsGift.mailFlag}" id="MailCountry" required="#{!memberCompProspectProductAsGift.mailFlag}"  styleClass="standardText" value="#{memberCompProspectProductAsGift.indMailCountryId}">
    		<f:selectItem  itemLabel="#{messages['please.select']}" itemValue=""/>
    		<f:selectItems value="#{memberCompProspectProductAsGift.countrySelectList}"/>
    		<a4j:support event="onclick" reRender="MailState" ajaxSingle="true"/>
    	</t:selectOneMenu>
	    
	    <h:outputText></h:outputText>
		<t:message for="MailState" styleClass="error"></t:message>
	    
	    <h:panelGroup>
			 <h:outputText value="*" styleClass="standardText_Mandatory" rendered="#{!memberCompProspectProductAsGift.mailFlag}"/>
			 <h:outputLabel for="MailState" value="#{messages['mail.state']}" styleClass="standardText_Label" />
		</h:panelGroup>
    	<t:selectOneMenu readonly="#{memberCompProspectProductAsGift.mailFlag}" id="MailState" required="#{!memberCompProspectProductAsGift.mailFlag}"  styleClass="standardText" value="#{memberCompProspectProductAsGift.indMailStateId}">
    		<f:selectItem  itemLabel="#{messages['please.select']}" itemValue=""/>
    		<f:selectItems value="#{memberCompProspectProductAsGift.indMailStateSelectList}"/>
    	</t:selectOneMenu>
	    
	   </t:panelGrid>
	
	<h:panelGrid width="100%">
		<h:outputText value="#{messages['nominee.info']}"
			styleClass="sub_header" />
	</h:panelGrid>
	
	<t:dataTable var="dependant" value="#{memberCompProspectProductAsGift.nomimeeList}" rows="20" width="50%">
		<t:column width="80%">
			<h:commandLink value="#{dependant.name}" styleClass="standardText_Label"></h:commandLink>
		</t:column>
		<t:column width="20%">
			<h:commandLink value="#{messages['remove']}" styleClass="standardText_Label" immediate="true" 
			actionListener="#{memberCompProspectProductAsGift.removeDependantListener}" ></h:commandLink>
			<f:param id="dependantId" value="#{dependant.newIcNo}"/>
		</t:column>
	</t:dataTable>
	<rich:spacer height="15"></rich:spacer>
	<t:panelGrid>
		<h:commandLink styleClass="standardText_Label" value="#{messages['add.more']}" action="#{memberCompProspectProductAsGift.navNomimeeAction}" onclick="setValue(1)"></h:commandLink>
	</t:panelGrid>
	
	<rich:spacer height="30"></rich:spacer>
	
	<t:panelGrid columns="2" columnClasses="standardTable_ColumnLeft_20,standardTable_ColumnLeft_80" width="100%">
		<t:outputText></t:outputText>
		<t:panelGroup>
		 	<h:commandButton value="#{messages['back']}" styleClass="button" action="#{memberCompProspectProductAsGift.backAction}"  immediate="true"></h:commandButton>
		 	<f:verbatim>&nbsp;</f:verbatim>
   			<h:commandButton value="#{messages['next']}" styleClass="button" action="#{memberCompProspectProductAsGift.navPaymentOption}"></h:commandButton>
   		</t:panelGroup>
	</t:panelGrid>
	
</rich:panel>